package com.amos.muexamclient.sys.controller;

import com.amos.bean.Result;
import com.amos.muexamclient.sys.service.SysMenuService;
import com.amos.muexamclient.sys.service.dto.SysMenuDTO;
import com.amos.muexamcore.core.BasePageController;
import com.amos.muexamcore.core.BasePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Copyright © 2018 五月工作室. All rights reserved.
 *
 * @Package com.amos.muexamclient.sys.controller
 * @ClassName SysMenuController
 * @Description TODO
 * @Author Amos
 * @Modifier
 * @Date 2020-03-24 14:35:22
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "/sys/menu")
public class SysMenuController extends BasePageController<SysMenuDTO> {
    @Autowired
    private SysMenuService sysMenuService;

    @Override
    public BasePageService<SysMenuDTO> getPageService() {
        return sysMenuService;
    }

    @PostMapping(value = "/list")
    public Result list(@RequestBody SysMenuDTO dto) {
        return Result.success(sysMenuService.listMenu(dto));
    }

    @GetMapping("/treeselect")
    public Result treeSelect() {
        return Result.success(sysMenuService.treeSelect());
    }

    @GetMapping(value = "/roleMenuTreeselect/{roleId}")
    public Result roleMenuTreeselect(@PathVariable("roleId") String roleId) {
        return Result.success(this.sysMenuService.roleMenuTreeselect(roleId));
    }
}
